import { createRouter, createWebHashHistory } from "vue-router"

const routes = [
  // 登录
  {
    path: "/login",
    name: "login",
    component: () => import("@/views/login"),
  },

  // 主页
  {
    path: "/",
    name: "/",
    component: () => import("@/layout"),
    redirect: "/main",

    // 二级路由
    children: [
      {
        path: "main",
        name: "main",
        component: () => import("@/views/Main.vue"),
      },
      {
        path: "user",
        name: "user",
        component: () => import("@/views/User.vue"),
      },
      {
        path: "reviewArticle",
        name: "reviewArticle",
        component: () => import("@/views/article/reviewArticle.vue"),
      },
      {
        path: "allArticle",
        name: "allArticle",
        component: () => import("@/views/article/allArticle.vue"),
      },
      {
        path: "test",
        name: "test",
        component: () => import("@/views/Test.vue"),
      },
    ],
  },
]

const router = createRouter({
  history: createWebHashHistory(),
  routes,
})

export default router
